package com.lesama.integer;

public class IntegerTest {
    /*
        已知字符串String s = "10,50,30,20,40";
        请将该字符串转换为整数并存入数组
        随后求出最大值打印
     */
    public static void main(String[] args) {
        String s = "10,50,30,20,40";
        String[] parts = s.split(",");
        Integer[] integers = new Integer[parts.length];
        for (int i = 0; i < parts.length; i++) {
            integers[i] = Integer.parseInt(parts[i]);
            System.out.println(integers[i]);
        }
        int max = integers[0];
        for (int i = 1; i < integers.length; i++) {
            max = Math.max(max, integers[i]);
        }
        System.out.println(max);
    }
}
